﻿using System;
using System.Linq;
using System.Collections.Generic;

using Kunlun.Models;

namespace Kunlun.BusinessLogic
{
    public partial class KunLunInformation
    {
		public static readonly KunLunEntities entities = new KunLunEntities();

        #region 获取最新新闻 News

        public static List<News> GetNewsByChanel(string channelName,int count)
        {
			var newsList = entities.News.Where(m => m.IsPub == true).Where(m => m.Channel == channelName).OrderByDescending(m => m.BeginDate).Take(count);

            return newsList.ToList();
        }

        #endregion

        #region 广告位

        public static List<AdManage> getAdByChanel(string channelName)
        {
            var adList = entities.AdManage.Where(m=>m.IsVisible==true).Where(m => m.Channel == channelName);

            return adList.ToList();
        }

        #endregion

    }
}
